package com.google.code.wicket.auth.component.value.provider;

import java.util.Collection;

import com.google.code.wicket.auth.component.value.resolver.ValueResolver;

/**
 * This is the opposite of {@link ValueResolver}. {@link ValueResolver}
 * determines which privileges are needed, this interfaces determines which
 * privileges are available.
 * <p>
 * Implementations must specify whether {@link #getValues()} or
 * {@link #hasValue(Object)} should be used by implementing {@link #useSingle()}.
 * 
 * @param <T>
 *            the value type, will usually be a string or an enum representing a
 *            role or privilege.
 */
public interface ValueProvider<T> {

    /**
     * Get all available privileges.
     * 
     * @return
     */
    Collection<T> getValues();

    /**
     * Is the specified privilege available?
     * 
     * @param value
     * @return
     */
    boolean hasValue(T value);

    /**
     * If true, clients must use {@link #hasValue(Object)}, otherwise
     * {@link #getValues()}.
     * 
     * @return
     */
    boolean useSingle();
}
